import { deleteByPrimaryKeyForProTableColumns, selectByPrimaryKeyForProTableColumns, insertForProTableColumns, updateForProTableColumns, deleteByMapForProTableColumns,updateByMapForProTableColumns, getOneForProTableColumns,getAllForProTableColumns,queryPageForProTableColumns, countForProTableColumns, insertBatchForProTableColumns, deleteBatchForProTableColumns,updateBatchForProTableColumns } from '@/services/system/api_protablecolumns';

export default {
    namespace: 'protablecolumns',

    state: {
        data: {
            list: [],
            pagination: {},
        },
    },

    effects: {
            *delete_by_primarykey_for_protablecolumns({ payload }, { call, put }) {
                const response = yield call(deleteByPrimaryKeyForProTableColumns, payload);
                yield put({
                    type: 'deleteByPrimaryKeyForProTableColumns',
                    payload: response,
                });
                
                                
                const responsedata = yield call(queryPageForProTableColumns, {});
                yield put({
                    type: 'queryPageForProTableColumns',
                    payload: responsedata,
                });
            },
            *select_by_primarykey_for_protablecolumns({ payload, callback }, { call, put }) {
                const response = yield call(selectByPrimaryKeyForProTableColumns, payload);
                yield put({
                    type: 'selectByPrimaryKeyForProTableColumns',
                    payload: response,
                });
                if (callback) callback();
            },
            *insert_for_protablecolumns({ payload, callback }, { call, put }) {
                const response = yield call(insertForProTableColumns, payload);
                yield put({
                    type: 'insertForProTableColumns',
                    payload: response,
                });
                
                const responsedata = yield call(queryPageForProTableColumns, {});
                yield put({
                    type: 'queryPageForProTableColumns',
                    payload: responsedata,
                });
                if (callback) callback();
            },
            *update_for_protablecolumns({ payload, callback }, { call, put }) {
                const response = yield call(updateForProTableColumns, payload);
                yield put({
                    type: 'updateForProTableColumns',
                    payload: response,
                });
                
                                
                const responsedata = yield call(queryPageForProTableColumns, {});
                yield put({
                    type: 'queryPageForProTableColumns',
                    payload: responsedata,
                });
                if (callback) callback();
            },
            *delete_by_map_for_protablecolumns({ payload, callback }, { call, put }) {
                const response = yield call(deleteByMapForProTableColumns, payload);
                yield put({
                    type: 'deleteByMapForProTableColumns',
                    payload: response,
                });
                if (callback) callback();
            },
            *update_by_map_for_protablecolumns({ payload, callback }, { call, put }) {
                const response = yield call(updateByMapForProTableColumns, payload);
                yield put({
                    type: 'updateByMapForProTableColumns',
                    payload: response,
                });
                if (callback) callback();
            },
            *get_one_for_protablecolumns({ payload, callback }, { call, put }) {
                const response = yield call(getOneForProTableColumns, payload);
                yield put({
                    type: 'getOneForProTableColumns',
                    payload: response,
                });
                if (callback) callback();
            },
            *get_all_for_protablecolumns({ payload, callback }, { call, put }) {
                const response = yield call(getAllForProTableColumns, payload);
                yield put({
                    type: 'getAllForProTableColumns',
                    payload: response,
                });
                if (callback) callback();
            },
            *query_page_for_protablecolumns({ payload, callback }, { call, put }) {
                const response = yield call(queryPageForProTableColumns, payload);
                yield put({
                    type: 'queryPageForProTableColumns',
                    payload: response,
                });
                if (callback) callback();
            },
            *count_for_protablecolumns({ payload, callback }, { call, put }) {
                const response = yield call(countForProTableColumns, payload);
                yield put({
                    type: 'countForProTableColumns',
                    payload: response,
                });
                if (callback) callback();
            },
            *insert_batch_for_protablecolumns({ payload, callback }, { call, put }) {
                const response = yield call(insertBatchForProTableColumns, payload);
                yield put({
                    type: 'insertBatchForProTableColumns',
                    payload: response,
                });
                if (callback) callback();
            },
            *delete_batch_for_protablecolumns({ payload, callback }, { call, put }) {
                const response = yield call(deleteBatchForProTableColumns, payload);
                yield put({
                    type: 'deleteBatchForProTableColumns',
                    payload: response,
                });
                if (callback) callback();
            },
            *update_batch_for_protablecolumns({ payload, callback }, { call, put }) {
                const response = yield call(updateBatchForProTableColumns, payload);
                yield put({
                    type: 'updateBatchForProTableColumns',
                    payload: response,
                });
                if (callback) callback();
            },
            },

    reducers: {
        deleteByPrimaryKeyForProTableColumns(state, action) {
            return {
                ...state,
                data: action.payload,
            };
        },
        selectByPrimaryKeyForProTableColumns(state, action) {
            return {
                ...state,
                data: action.payload,
            };
        },
        insertForProTableColumns(state, action) {
            return {
                ...state,
                data: action.payload,
            };
        },
        updateForProTableColumns(state, action) {
            return {
                ...state,
                data: action.payload,
            };
        },
        deleteByMapForProTableColumns(state, action) {
            return {
                ...state,
                data: action.payload,
            };
        },
        updateByMapForProTableColumns(state, action) {
            return {
                ...state,
                data: action.payload,
            };
        },
        getOneForProTableColumns(state, action) {
            return {
                ...state,
                data: action.payload,
            };
        },
        getAllForProTableColumns(state, action) {
            return {
                ...state,
                data: action.payload,
            };
        },
        queryPageForProTableColumns(state, action) {
            return {
                ...state,
                data: action.payload,
            };
        },
        countForProTableColumns(state, action) {
            return {
                ...state,
                data: action.payload,
            };
        },
        insertBatchForProTableColumns(state, action) {
            return {
                ...state,
                data: action.payload,
            };
        },
        deleteBatchForProTableColumns(state, action) {
            return {
                ...state,
                data: action.payload,
            };
        },
        updateBatchForProTableColumns(state, action) {
            return {
                ...state,
                data: action.payload,
            };
        },
    },
};
